if(!kjq.controls){
    kjq.controls = {};
}
kjq.controls.Window = function Window(opts) {
    
        kjq.utils.addObjectOneAttributeToObjectTwoo(opts, this);
        if(!this.title){
            this.title='window';
        }
        if(!this.id){
            this.id = kjq.utils.getRandomElementId();
        }
        if(!this.modal){
            this.modal = true;
        }
        if(!this.viewModel){
            throw 'ViewModel is undefined.';
        }
        this.content = $('<div></div>');
        this.div = '<div id="${id}" title="${title}">';
        this.configOptions = opts;
    
    this.show = function(){
        var me = this;
        var dialog = me.div.replace('${id}', me.id).replace('${title}', me.title).concat('</div>');
        dialog=$(dialog);
        dialog.append(me.content);
        $('body').append(dialog);
        ko.applyBindings(me.viewModel, document.getElementById(me.id));
        $('#'.concat(me.id)).dialog(this.configOptions);
    };
    
    this.addElement = function(element){
        this.content.append(element);
    }
    
};
Window = kjq.controls.Window;
